<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组别添加</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <form action="" method="post" class="form form-horizontal" id="form-admin-role-add" onsubmit="return false">

            <div class="form-group">
                <label class="col-sm-3 control-label">组别名称：</label>
                <div class="col-sm-8">
                    <input id="mt4_group" name="mt4_group" value="{$data.mt4_group}"  class="form-control" type="text"  datatype="*4-16" nullmsg="不能为空">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">返佣比率：</label>
                <div class="col-sm-8">
                    <input id="ratio" name="ratio" value="{$data.ratio}"  class="form-control" type="number"  datatype="*4-16" nullmsg="不能为空">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">组别类型：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="type" id="type">
                        <option value="1" <if condition="$data.type eq 1">selected="selected"</if>>短期</option>
                        <option value="2" <if condition="$data.type eq 2">selected="selected"</if>>外汇</option>
                    </select>
                </div>
            </div>

            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <button type="button" class="btn btn-success radius"  onclick="getCheckAdIds(this,'{$data.id}')" id="admin-role-save" name="admin-role-save">
                        <i class="icon-ok"></i> 确定
                    </button>

                    <button style="margin-left: 20px;" onclick="layer_close();" class="btn btn-success btn-warning">
                        <i class="icon-ok"></i> 返回
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 全局js -->
<include file="Index/common_js"/>
<!-- Peity -->

<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/common/js/layer_show.js"></script>

<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<!-- Peity -->
<script>

    function getCheckAdIds(obj,id) {
        var mt4_group= $("#mt4_group").val();
        var type= $("#type").val();
        var ratio= $("#ratio").val();
        var myReg = /^[a-zA-Z0-9_]{0,}$/;
        if(mt4_group=='' || type=='') {
            layer.msg('不能为空');
        }else if (!myReg.test(mt4_group)) {
            layer.msg("不能含有中文或特殊字符");
        } else {
            $.post('__MODULE__/System/group_saveData',{id:id,mt4_group:mt4_group,type:type,ratio:ratio},function (data) {
                if(data.status==1){
                    layer.msg(data.msg);
                    setTimeout(function () {location.reload();}, 1000);
                }else if(data.status==0){
                    layer.msg(data.error);
                }else{
                    layer.msg('网络错误');
                }
            })
        }
    }
</script>
</body>
</html>
